package com.example.demo;

public class testDecrypt {
    public static void main(String[] args) throws Exception {
        encryptSM4Key();
    }
    //76c16671e00bdbab22e35cb9923f9005
    public static String decryptSM4Key(String a,String b) throws Exception {
        String decryptSM4Key = SM2Util.decrypt(a);
        String decrypt = SM4Util.decrypt(b, decryptSM4Key);
        return decrypt;
    }

    /**
     * 0424b272fdfb6a166add4d8acc1627a5b6237780ea6b86caa40d6c1d17a7270ea8943a0e2f18c14862742bebfbf676933e6f0345fd7817148e9037bcf482a8a02eb74c5fdb35a4b289f876d0235f1ee8cef69b749d6db94497140f339d1063ebe4e07043c9abddd262fb322e7daa2da5c0dc6810aed0e753a8eadfe0f109f582aa
     * 4cda261e6e82550ceb380d7f2b857f3e
     */
    public static String encryptSM4Key() throws Exception {
        String data = "{\n" +
                "  \"body\" : {\n" +
                "    \"companyId\" : \"89c772ce3f8042ad9873770e35d6900a\"\n" +
                "  },\n" +
                "  \"cloudKey\" : \"returnResult\",\n" +
                "  \"requestSource\" : \"CLApproveWebH5\",\n" +
                "  \"version\" : 1\n" +
                "}";
        String decrypt = SM4Util.encrypt(data, "4cda261e6e82550ceb380d7f2b857f3e");
        System.out.println(decrypt);
        System.out.println(decryptSM4Key("0424b272fdfb6a166add4d8acc1627a5b6237780ea6b86caa40d6c1d17a7270ea8943a0e2f18c14862742bebfbf676933e6f0345fd7817148e9037bcf482a8a02eb74c5fdb35a4b289f876d0235f1ee8cef69b749d6db94497140f339d1063ebe4e07043c9abddd262fb322e7daa2da5c0dc6810aed0e753a8eadfe0f109f582aa",decrypt));
        return decrypt;
    }

}
